package com.itxiao.controller;
import com.itxiao.entity.SysDictType;
import com.itxiao.pojo.bo.Page;
import com.itxiao.pojo.vo.R;
import com.itxiao.service.SysDictTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 字典类型表(SysDictType)表控制层
 *
 * @author makejava
 * @since 2025-10-11 16:42:07
 */
@RestController
@RequestMapping("admin/api/v1/sys-dict")
@Api(tags = "字典类型")
@CrossOrigin
public class SysDictTypeController  {
    /**
     * 服务对象
     */
    @Resource
    private SysDictTypeService sysDictTypeService;

    @ApiOperation("分页查询")
    @PostMapping("/query")
    public R queryList(@RequestBody Page page) {
        return sysDictTypeService.queryList(page);
    }

    @ApiOperation("添")
    @PostMapping("/add")
    public R add(@RequestBody SysDictType sysDictType) {
        return sysDictTypeService.add(sysDictType);
    }

    @ApiOperation("修改")
    @PostMapping("/update")
    public R update(@RequestBody SysDictType sysDictType) {
        return sysDictTypeService.updateInfo(sysDictType);
    }
    @ApiOperation("批量删除")
    @DeleteMapping("/delete")
    public R deleteBatch(@RequestBody List<Integer> ids) {
        return R.ok(sysDictTypeService.removeBatchByIds(ids));
    }

    @ApiOperation("查询详情")
    @DeleteMapping("/query-detail/{id}")
    public R getById(@PathVariable Integer id) {
        return R.ok(sysDictTypeService.getById(id));
    }
    @ApiOperation("单个删除")
    @DeleteMapping("/delete/{id}")
    public R deleteById(@PathVariable Integer id) {
        return R.ok(sysDictTypeService.deleteById(id));
    }
}

